package onet

import (
	"net"
)

type Conn interface {
	Next(n int) (buf []byte, err error)
	Peek(n int) (buf []byte, err error)
	Discard(n int) (discarded int, err error)
	InboundBuffered() (n int)

	AsyncWrite(buf []byte) (err error)
	OutboundBuffered() (n int)

	Close() (err error)

	Context() (ctx any)
	SetContext(ctx any)
	LocalAddr() (addr net.Addr)
	RemoteAddr() (addr net.Addr)
}

type EventHandler interface {
	OnOpen(c Conn)
	OnData(c Conn)
	OnClose(c Conn, err error)
}
